package cn.gp.chat;

import cn.gp.chat.service.MessageService;
import cn.gp.chat.websocket.ChatWebSocketServer;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;

/**
 * @ClassName ChatServerApplication
 * @Description TODO
 * @Author He Guoping
 * @Date 2025/6/17 12:59
 * @Version JDK17
 */
@SpringBootApplication(scanBasePackages = {"cn.gp.chat"})
@MapperScan({"cn.gp.chat.mapper"})
public class ChatServerApplication {
    public static void main(String[] args) {
        ApplicationContext context = SpringApplication.run(ChatServerApplication.class, args);
        
        // 初始化WebSocket服务
        ChatWebSocketServer.setMessageService(context.getBean(MessageService.class));
    }
}
